<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	
	<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <style>
    	.setdiv1{
    		background: transparent;
    		float: right;
    		height: 30.67;
    		width: 242.67;
    		text-align: center;
    	}
    	.userMenu {
            float: left;
        	width: 200px;
        }
            
        #content {
             float: left;
       }
       .setbg{
    		border: 0px none;
    		height: 80%;
    		width:80%;
    		background-repeat: no-repeat;
    		background-size: 100%;
    	}
        </style>
        <meta charset="utf-8">
        <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>

  </head>
  
  <body>
  <body>
  		<div class="col-md-12 column">
		<div class="setdiv1">
  			<%if(session.getAttribute("username").toString()==null){%>
  			尚未登录 ,<a href="Login.jsp">点击登录</a>
  			<%}else{%>
  				欢迎登录，
  			<%=session.getAttribute("username").toString()%>
  			<% }%>
  			</div>
		</div>
        <div class="userWrap">
            <ul class="userMenu">
            	<br>
                <li class="info" data-id="look">查看商品</li>
                <li data-id="find">查找商品</li>
                <li data-id="trade">商品管理</li>
                <li data-id="add">添加商品</li>
            </ul>
            <div id="content" class="setbg"></div>
        </div>
    </body>
    <script>
        $(function() {
            $(".userMenu").on("click", "li", function() {
                var sId = $(this).data("id"); //获取data-id的值
                window.location.hash = sId; //设置锚点
                loadInner(sId);
            });
 
            function loadInner(sId) {
                var sId = window.location.hash;
                var pathn, i;
                switch(sId) {
                    case "#look":
                        pathn = "lookgood.jsp";
                        i = 1;
                        break;
                    case "#find":
                        pathn = "find.jsp";
                        i = 2;
                        break;
                    case "#add":
                    	pathn = "addgood.jsp";
                        i = 3;
                        break;
                    default:
                        pathn = "goodservlet";
                        i = 0;
                        break;
                }
                $("#content").load(pathn);
                $(".userMenu li").eq(i).addClass("current").siblings().removeClass("current"); //当前列表高亮
            }
            var sId = window.location.hash;
            loadInner(sId);
        });
    </script>
</html>